set scroll of card field "CustomFileName Doc" to 0
set scroll of card field "ChooseIcon Doc" to 0
end openCard
-- part 6 (button)
-- low flags: 00
-- high flags: 2004
-- rect: left=226 top=285 right=338 bottom=287
-- title width / last selected line: 0
-- icon id / first selected line: 5155 / 5155
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: New Button
----- HyperTalk script -----
on mouseUp
show card field "Oscar"
end mouseUp
-- part 1 (field)
-- low flags: 01
-- high flags: 2007
-- rect: left=5 top=95 right=271 bottom=206
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: ChooseIcon Doc
-- part 2 (field)
-- low flags: 01
-- high flags: 2007
-- rect: left=306 top=95 right=271 bottom=507
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: CustomFileName Doc
-- part 4 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=209 top=95 right=177 bottom=304
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: The Bottom Line Button
----- HyperTalk script -----
on mouseUp
show card field "The Bottom Line"
end mouseUp
-- part 5 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=209 top=181 right=254 bottom=304
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Demos
----- HyperTalk script -----
on mouseUp
visual effect iris open
go to second card
end mouseUp
-- part 3 (field)
-- low flags: 81
-- high flags: 2004
-- rect: left=13 top=21 right=338 bottom=500
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 12
-- style flags: 256
-- line height: 16
-- part name: The Bottom Line
----- HyperTalk script -----
on mouseUp
hide card field "The Bottom Line"
end mouseUp
-- part 7 (field)
-- low flags: 01
-- high flags: 2004
-- rect: left=84 top=53 right=282 bottom=423
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: Oscar
----- HyperTalk script -----
on mouseUp
hide card field "Oscar"
end mouseUp
-- part 8 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=333 top=277 right=312 bottom=475
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: What's New
----- HyperTalk script -----
on mouseUp
show card field "The New"
end mouseUp
-- part 9 (field)
-- low flags: 81
-- high flags: 2004
-- rect: left=231 top=85 right=335 bottom=503
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 256
-- line height: 16
-- part name: The New
----- HyperTalk script -----
on mouseUp
hide card field "The New"
end mouseUp
-- part contents for card part 1
----- text -----
ChooseIcon XFCN 1.5b1
•••••••
This HyperCard external function was originally created to help give stack authors more control over the user interactive creation of buttons from scripts. What!?!?
•••••••
ChooseIcon simply puts up a familiar dialog box containing the available icons, and returns the selected icon's ID number. It returns 0 if the user chooses "No Icon" and empty if the user cancels.
•••••••
It will take two optional parameters. The first is a text string to be placed at the top of the dialog box as a prompt string. The second is a way of restricting the displayed icons to the ones in the current stack only (not the system or HyperCard). A "1" passed as the second parameter will enable this restriction.
•••••••
In order for the XFCN to work you need all four of the following resources:
---------------------------------
XFCN "ChooseIcon" ID = 11112
LDEF "ChooseIcon" ID = 12
DLOG "ChooseIcon" ID = 10057
DITL "ChooseIcon" ID = 21662
---------------------------------
•••••••
If you would like to customize the dialog box, that's fine, just don't change it's ID number, don't remove any items (but you may add text and PICTs, etc.), and DON'T change the size of the user item which displays the icons (very important).
•••••••
If you want to include a prompt string which is larger than you can pass through HyperTalk, or which contains ICONS or PICTS, you can just paste them with ResEdit over the existing user item (do not delete it, but you may move it), and then pass an empty string as the prompt parameter so the user item will stay blank.
•••••••
Please use ChooseIcon with caution, as it is a beta version, not fully tested and in no way guaranteed. Please let me know about any bugs.
-- part contents for card part 2
----- text -----
CustomFileName XFCN 2.0b1
•••••••
Poor Steve Maller, he writes a truly elegant piece of work like the FileName XFCN, and then people like me come along and nasty it up with all kinds of stuff that would make Scott Knaster pop out in hives if he disassembled the code.
•••••••
With that said, CustomFileName is basically the FileName XFCN, i.e., it puts up the standard file dialog box and returns the pathway of the selected file. It returns empty if the user cancels. You may pass the file Type as the first parameter to restrict the display to files of a given type,e.g., STAK, APPL, etc. Passing no parameters or a null string allows all file types to be displayed.
•••••••
The first thing that is different about CustomFileName is that it returns three lines in its result. The first line is the pathway just as in FileName, the second line is the the file Type of the selected file, and the third line is the Creator code. This is useful if your script is creating a button linking to the selected file and you need to know a) is it a document or an application, b) if a document, then what is the creator application, and c) is it a stack?
•••••••
If you just needed the pathway in your result you would script:
'put line 1 of CustomFileName()¬   into temp'
This would behave just like FileName.
•••••••
The next major difference is that CustomFileName can take a second parameter. This is a text string which will appear as a prompt string at the top of the dialog box.
•••••••
An added feature of Version 2.0b1, suggested by Henry Lowe, is that it will accept a third parameter which should be the name you wish to assign to the OPEN button of the Standard File box. If you omit this parameter or mess up the format, the OPEN button remains as is. The proper format is the name you wish to use followed by a slash followed by the command key eqivalent (you must include one). See sample button #8 for an example of this.
•••••••
The final difference is that CustomFileName uses its own DLOG and DITL resources instead of the system's. Thus you can change the appearance and add your own fancy prompt strings if you like. Don't remove or change any of the existing items though (you can change the size of the whole box and you can paste over the prompt string item).
•••••••
In order for the XFCN to work you need the three following resources:
---------------------------------
XFCN "CustomFileName" ID = 12105
DLOG "CustomFileName" ID = 17654
DITL "CustomFileName" ID = 18134
---------------------------------
•••••••
As is the case with ChooseIcon, CustomFileName is a beta version, and not guaranteed to be bug free. Please use it with caution, and let me know of any bugs.
-- part contents for card part 3
----- text -----
Two XFCN's. Particularly useful for Finder replacements, but there are undoubtedly other applications.
ChooseIcon:
Puts up a dialog box with icons displayed (like button info 'Icon' button) and returns icon id. Returns empty if cancelled, 0 if user chooses "No Icon." Two optional parameters, first is any prompt string to be displayed, 2nd is "1" if you want to display only the current stack's icons.
CustomFileName:
Just like FileName only returns three lines in result:
1) The pathway (just like FileName).
2) The file Type
3) The file Creator
Two optional parameters. Like FileName, the first parameter can be a file Type and will restrict the display to that type. The second is a text prompt string to appear at the top of the Dialog Box. Uses its own DLOG & DITL so you could customize further.
-- part contents for card part 7
----- text -----
ChooseIcon & CustomFileName XFCN's
These two XFCN's have been written to help in the clean management of "Finder Replacement" type stacks, but I'm sure they are useful for other HyperCard undertakings as well. The most thoughtful, artistic, and easy to use "Finder Replacement" I have seen to date is WorkStation 4.0 written by Debbie Iwatate (K.IWATATE on GEnie). It will be available shortly.
My XFCN's are entirely in the public domain and may be used any way you see fit. I always appreciate a little credit in the stacks. Note: These are beta versions, and while I have tried to eliminate bugs, please use them with caution, and let me know of any nasties.
Oscar F. Hills
34 Maplewood Terrace
Hamden, CT 06514
(203) 287-1913
(CIS => 73317, 3005 GEnie => O.HILLS)
-- part contents for card part 9
----- text -----
CustomFileName Version 2.0b1
1) Bug fix: If you wish to display   ALL file types AND use a prompt,   pass a null string for the first   parameter. This previously   caused NO file types to be   displayed (OOPS!)
2) If you wish to rename the Open   button pass the name/command-  key-eqivalent as a third   parameter,e.g., "Select/S"